<div class="g_menu">
    <a id="home" class="on" href="/">平台</a><a id="material" href="<?php echo $this->url('material',
             array('action'=>'index'));?>">溯源</a><a id="my" href="<?php echo $this->url('my',
             array('action'=>'home'));?>">我的</a>
</div>
<script type="text/javascript">
    $(function(){
    	var url=window.location.href;
    	var reg = new Array(); 
    	reg[0] = new RegExp('my', 'i');
    	reg[1] = new RegExp('material', 'i');
    	for(r in reg){
			if(reg[r].test(url)){
				$(".g_menu a").removeClass("on");
				if(0==r){
					$("#my").addClass("on");
					break;
				}else if(1==r){
					$("#material").addClass("on");
					break
				}
			}
        }
    });
</script>